package com.liu.pool_study.diyPool;

public class MyTask implements Runnable{

    private int id;

    public MyTask(int id) {
        this.id = id;
    }

    @Override
    public void run() {
    String name = Thread.currentThread().getName();
        System.out.println("线程"+name +"即将执行任务" + id);
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("线程"+name +"完成了任务" + id);
    }

    @Override
    public String toString() {
        return "MyTask{" +
                "id=" + id +
                '}';
    }
}
